Dirk Eddelbuettel: Slides from Rcpp workshop / master class yesterday
Update: One link corrected.
Update: One link corrected.
I realized I never announced this on the blog, so without further ado.... Rcpp Workshop in Chicago on April 28, 2011 This year's R/Finance conference will be preceded by a full-day masterclass on Rcpp and related topics which will be held on Thursday, April 28, 2011, on the University of Illinois at Chicago campus. Join Dirk Eddelbuettel and Romain Francois for six hours of detailed and hands-on instructions and discussions around Rcpp, inline, RInside, RcppArmadillo and other packages---in an intimate small-group setting. The full-day format allows to combine a morning introductory session with a more advanced afternoon session while leaving room for sufficient breaks. There will be about six hours of instructions, a one-hour lunch break and two half-hour coffee breaks. Morning session: "A hands-on introduction to R and C++" The morning session will provide a practical introduction to the Rcpp package (and other related packages). The focus will be on simple and straightforward applications of Rcpp in order to extend R and/or to significantly accelerate the execution of simple functions. The tutorial will cover the inline package which permits embedding of self-contained C, C++ or Fortran code in R scripts. We will also discuss RInside to embed R code in C++ applications, as well as standard Rcpp extension packages such as RcppArmadillo for linear algebra and RcppGSL. Afternoon session: "Advanced R and C++ topics" This afternoon tutorial will provide a hands-on introduction to more advanced Rcpp features. It will cover topics such as writing packages that use Rcpp, how 'Rcpp modules' and the new R ReferenceClasses interact, and how 'Rcpp sugar' lets us write C++ code that is often as expressive as R code. Another possible topic, time permitting, may be writing glue code to extend Rcpp to other C++ projects. We also hope to leave some time to discuss problems brought by the class participants. Prerequisites Knowledge of R as well as general programming knowledge; C or C++ knowledge is helpful but not required. Users should bring a laptop set up so that R packages can be built. That means on Windows, Rtools needs to be present and working, and on OS X the Xcode package should be installed. Registration Registration is available via the R/Finance conference at
http://www.RinFinance.com/register/or directly at RegOnline
http://www.regonline.com/930153The cost is USD 500 for the whole day, and space will be limited. Questions Please contact us directly at RomainAndDirk@r-enthusiasts.com.
tkdensity
demo that comes with
R itself. It is a good point of departure as Tcl/Tk makes it very
portable---in fact it should run on every platform that runs R---and quite
expressive. And having followed some of the GUI experiments around R over
the years, I have also seen various re-implementations using different GUI frameworks. And so I am adding
mine to this body of work:
The problem I addressed first was actual buildability. For the
RInside
examples, Romain and I provide a Makefile that just works by making
calls to R itself to learn about flags
for R,
Rcpp and
RInside such
that all required headers and libraries are found. That is actually
relatively straightforward (and documented in our vignettes) but a little
intimidating at first---which is why a ready-made Makefile is a good thing.
Qt of course uses qmake
and the .pro
files to encode / resolve dependencies. So task one
was to map what our Makefile does into its variables. Turns out that wasn't all that
hard:
The double dollar signs and escaping of parentheses are a little tedious, but hey it works and expands the compiler and linker flags such that everything <emjust works="Works">. The code itself is pretty straightforward too. We instantiate the RInside object as well as the main Qt application object. We then instantiate a new object of class## -*- mode: Makefile; c-indent-level: 4; c-basic-offset: 4; tab-width: 8; -*- ## ## Qt usage example for RInside, inspired by the standard 'density ## sliders' example for other GUI toolkits ## ## Copyright (C) 2011 Dirk Eddelbuettel and Romain Francois TEMPLATE = app HEADERS = qtdensity.h SOURCES = qtdensity.cpp main.cpp QT += svg ## comment this out if you need a different version of R, ## and set set R_HOME accordingly as an environment variable R_HOME = $$system(R RHOME) ## include headers and libraries for R RCPPFLAGS = $$system($$R_HOME/bin/R CMD config --cppflags) RLDFLAGS = $$system($$R_HOME/bin/R CMD config --ldflags) RBLAS = $$system($$R_HOME/bin/R CMD config BLAS_LIBS) RLAPACK = $$system($$R_HOME/bin/R CMD config LAPACK_LIBS) ## if you need to set an rpath to R itself, also uncomment #RRPATH = -Wl,-rpath,$$R_HOME/lib ## include headers and libraries for Rcpp interface classes RCPPINCL = $$system($$R_HOME/bin/Rscript -e \'Rcpp:::CxxFlags\(\)\') RCPPLIBS = $$system($$R_HOME/bin/Rscript -e \'Rcpp:::LdFlags\(\)\') ## for some reason when building with Qt we get this each time ## so we turn unused parameter warnings off RCPPWARNING = -Wno-unused-parameter ## include headers and libraries for RInside embedding classes RINSIDEINCL = $$system($$R_HOME/bin/Rscript -e \'RInside:::CxxFlags\(\)\') RINSIDELIBS = $$system($$R_HOME/bin/Rscript -e \'RInside:::LdFlags\(\)\') ## compiler etc settings used in default make rules QMAKE_CXXFLAGS += $$RCPPWARNING $$RCPPFLAGS $$RCPPINCL $$RINSIDEINCL QMAKE_LFLAGS += $$RLDFLAGS $$RBLAS $$RLAPACK $$RCPPLIBS $$RINSIDELIBS ## addition clean targets QMAKE_CLEAN += qtdensity Makefile
QtDensity
that
will launch the main widget; it is given a reference to the
RInside object.
The definition of the main object is pretty simple: a few private variables, and a few functions to interact with the GUI and get values from the radio buttons, slider or input field---as well as functions to update the chart or re-draw the random variables.// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8; -*- // // Qt usage example for RInside, inspired by the standard 'density // sliders' example for other GUI toolkits // // Copyright (C) 2011 Dirk Eddelbuettel and Romain Francois #include <QApplication> #include "qtdensity.h" int main(int argc, char *argv[]) RInside R(argc, argv); // create an embedded R instance QApplication app(argc, argv); QtDensity qtdensity(R); return app.exec();
Lastly, no big magic in the code either (apart from the standard magic provided by RInside). A bit of standard GUI layouting, and then some functions to pick values from the inputs as well as to compute / update the output. One issue is worth mentioning. The screenshot and code show the second version of this little application. I built a first one using a standard portable network graphics (png) file. That was fine, but not crisp as png is a pixel format so I went back and experimented with scalable vector graphics (svg) instead. One can create svg output with R in a number of ways, one of which is the cairoDevice package by Michael Lawrence (who also wrote RGtk2 and good chunks of Ggobi). Now, it turns out that Qt displays the so-called SVG tiny standard whereas R creates a fuller SVG format. Some discussion with Michael reveals that one can modify the svg file suitably (which is what the function// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8; -*- // // Qt usage example for RInside, inspired by the standard 'density // sliders' example for other GUI toolkits // // Copyright (C) 2011 Dirk Eddelbuettel and Romain Francois #ifndef QTDENSITY_H #define QTDENSITY_H #include <RInside.h> #include <QMainWindow> #include <QHBoxLayout> #include <QSlider> #include <QSpinBox> #include <QLabel> #include <QTemporaryFile> #include <QSvgWidget> class QtDensity : public QMainWindow Q_OBJECT public: QtDensity(RInside & R); private slots: void getBandwidth(int bw); void getKernel(int kernel); void getRandomDataCmd(QString txt); void runRandomDataCmd(void); private: void setupDisplay(void); // standard GUI boilderplate of arranging things void plot(void); // run a density plot in R and update the void filterFile(void); // modify the richer SVG produced by R QSvgWidget *m_svg; // the SVG device RInside & m_R; // reference to the R instance passed to constructor QString m_tempfile; // name of file used by R for plots QString m_svgfile; // another temp file, this time from Qt int m_bw, m_kernel; // parameters used to estimate the density QString m_cmd; // random draw command string ; #endif
filterFile
below does) and it all works. Well:
almost. There is a bug (and Michael thinks it is the SVG rendering) in which
the density estimate does not get clipped to the plotting region.
What the little application does is actually somewhat neat for the few lines. One key features is that the generated data can be specified directly by an R expression which allows for mixtures (as shown, and as is the default). With that it easy to see how many points are needed in the second hump to make the estimate multi-modal, and how much of a distance between both centers is needed and so on. Obviously, the effect of the chosen kernel and bandwidth can also be visualized. And with the chart the being a support vector graphics display, we can resize and scale at will and it still looks crisp. The code (for both the simpler png variant and the svg version shown here) is in the SVN repository for RInside and will be in the next release. Special thanks to Michael Lawrence for patiently working through some svg woes with me over a few emails.// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8; -*- // // Qt usage example for RInside, inspired by the standard 'density // sliders' example for other GUI toolkits -- this time with SVG // // Copyright (C) 2011 Dirk Eddelbuettel and Romain Francois #include <QtGui> #include "qtdensity.h" QtDensity::QtDensity(RInside & R) : m_R(R) m_bw = 100; // initial bandwidth, will be scaled by 100 so 1.0 m_kernel = 0; // initial kernel: gaussian m_cmd = "c(rnorm(100,0,1), rnorm(50,5,1))"; // simple mixture m_R["bw"] = m_bw; // pass bandwidth to R, and have R compute a temp.file name m_tempfile = QString::fromStdString(Rcpp::as<std::string>(m_R.parseEval("tfile <- tempfile()"))); m_svgfile = QString::fromStdString(Rcpp::as<std::string>(m_R.parseEval("sfile <- tempfile()"))); m_R.parseEvalQ("library(cairoDevice)"); setupDisplay(); void QtDensity::setupDisplay(void) QWidget *window = new QWidget; window->setWindowTitle("Qt and RInside demo: density estimation"); QSpinBox *spinBox = new QSpinBox; QSlider *slider = new QSlider(Qt::Horizontal); spinBox->setRange(5, 200); slider->setRange(5, 200); QObject::connect(spinBox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int))); QObject::connect(slider, SIGNAL(valueChanged(int)), spinBox, SLOT(setValue(int))); spinBox->setValue(m_bw); QObject::connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(getBandwidth(int))); QLabel *cmdLabel = new QLabel("R command for random data creation"); QLineEdit *cmdEntry = new QLineEdit(m_cmd); QObject::connect(cmdEntry, SIGNAL(textEdited(QString)), this, SLOT(getRandomDataCmd(QString))); QObject::connect(cmdEntry, SIGNAL(editingFinished()), this, SLOT(runRandomDataCmd())); QGroupBox *kernelRadioBox = new QGroupBox("Density Estimation kernel"); QRadioButton *radio1 = new QRadioButton("&Gaussian"); QRadioButton *radio2 = new QRadioButton("&Epanechnikov"); QRadioButton *radio3 = new QRadioButton("&Rectangular"); QRadioButton *radio4 = new QRadioButton("&Triangular"); QRadioButton *radio5 = new QRadioButton("&Cosine"); radio1->setChecked(true); QVBoxLayout *vbox = new QVBoxLayout; vbox->addWidget(radio1); vbox->addWidget(radio2); vbox->addWidget(radio3); vbox->addWidget(radio4); vbox->addWidget(radio5); kernelRadioBox->setMinimumSize(260,140); kernelRadioBox->setMaximumSize(260,140); kernelRadioBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); kernelRadioBox->setLayout(vbox); QButtonGroup *kernelGroup = new QButtonGroup; kernelGroup->addButton(radio1, 0); kernelGroup->addButton(radio2, 1); kernelGroup->addButton(radio3, 2); kernelGroup->addButton(radio4, 3); kernelGroup->addButton(radio5, 4); QObject::connect(kernelGroup, SIGNAL(buttonClicked(int)), this, SLOT(getKernel(int))); m_svg = new QSvgWidget(); runRandomDataCmd(); // also calls plot() QGroupBox *estimationBox = new QGroupBox("Density estimation bandwidth (scaled by 100)"); QHBoxLayout *spinners = new QHBoxLayout; spinners->addWidget(spinBox); spinners->addWidget(slider); QVBoxLayout *topright = new QVBoxLayout; topright->addLayout(spinners); topright->addWidget(cmdLabel); topright->addWidget(cmdEntry); estimationBox->setMinimumSize(360,140); estimationBox->setMaximumSize(360,140); estimationBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); estimationBox->setLayout(topright); QHBoxLayout *upperlayout = new QHBoxLayout; upperlayout->addWidget(kernelRadioBox); upperlayout->addWidget(estimationBox); QHBoxLayout *svglayout = new QHBoxLayout; svglayout->addWidget(m_svg); QVBoxLayout *outer = new QVBoxLayout; outer->addLayout(upperlayout); outer->addLayout(svglayout); window->setLayout(outer); window->show(); void QtDensity::plot(void) const char *kernelstrings[] = "gaussian", "epanechnikov", "rectangular", "triangular", "cosine" ; m_R["bw"] = m_bw; m_R["kernel"] = kernelstrings[m_kernel]; // that passes the string to R std::string cmd1 = "Cairo(width=6,height=6,pointsize=10,surface='svg',filename=tfile); " "plot(density(y, bw=bw/100, kernel=kernel), xlim=range(y)+c(-2,2), main=\"Kernel: "; std::string cmd2 = "\"); points(y, rep(0, length(y)), pch=16, col=rgb(0,0,0,1/4)); dev.off()"; std::string cmd = cmd1 + kernelstrings[m_kernel] + cmd2; // stick the selected kernel in the middle m_R.parseEvalQ(cmd); filterFile(); // we need to simplify the svg file for display by Qt m_svg->load(m_svgfile); void QtDensity::getBandwidth(int bw) if (bw != m_bw) m_bw = bw; plot(); void QtDensity::getKernel(int kernel) if (kernel != m_kernel) m_kernel = kernel; plot(); void QtDensity::getRandomDataCmd(QString txt) m_cmd = txt; void QtDensity::runRandomDataCmd(void) std::string cmd = "y <- " + m_cmd.toStdString(); m_R.parseEvalQ(cmd); plot(); // after each random draw, update plot with estimate void QtDensity::filterFile() // cairoDevice creates richer SVG than Qt can display // but per Michaele Lawrence, a simple trick is to s/symbol/g/ which we do here QFile infile(m_tempfile); infile.open(QFile::ReadOnly); QFile outfile(m_svgfile); outfile.open(QFile::WriteOnly QFile::Truncate); QTextStream in(&infile); QTextStream out(&outfile); QRegExp rx1("<symbol"); QRegExp rx2("</symbol"); while (!in.atEnd()) QString line = in.readLine(); line.replace(rx1, "<g"); // so '<symbol' becomes '<g ...' line.replace(rx2, "</g");// and '</symbol becomes '</g' out << line << "\n"; infile.close(); outfile.close();
Update: Some typos fixed.
Update 2: Two URLs corrected.
and then needs several paragraphs to explain what is going on, what is needed to compile and then how to load it --- I simply could not resist. Almost immediately, I emailed back to him something as simple as this using both our Rcpp package as well as the wonderful inline package by Oleg which Romain and I more or less adopted:#include <R.h> #include <Rinternals.h> SEXP esoteric_rev (SEXP x) SEXP res; int i, r, P=0; PROTECT(res = allocVector(REALSXP, length(x))); P++; for(i=length(x), r=0; i>0; i--, r++) REAL(res)[r] = REAL(x)[i-1]; copyMostAttrib(x, res); UNPROTECT(P); return res;
Here we load inline, and then define a three-line C++ program using facilities from our Rcpp package. All we need to revert a vector is to first access its R object in C++ by instantiating the R vector as alibrary(inline) ## for cxxfunction() src <- 'Rcpp::NumericVector x = Rcpp::NumericVector(xs); std::reverse(x.begin(), x.end()); return(x);' fun <- cxxfunction(signature(xs="numeric"), body=src, plugin="Rcpp") fun( seq(0, 1, 0.1) )
NumericVector
.
These C++ classes then provide iterators which are compatible with the
Standard Template Library (STL). So we simply
call the STL function reverse
pointing the beginning and end
of the vector, and are done! Rcpp then allows us the return the C++ vector
which it turns into an R vector. Efficient in-place reversal, just like Jeff
had motivated, in three lines. Best of all, we can execute this from within R itself:
Lastly, Jeff shows a more complete example wherein a new vector is created, and any potential attributes are copied as well. Naturally, we can do that too. First, we usedR> library(inline) ## for cxxfunction() R> src <- 'Rcpp::NumericVector x = Rcpp::NumericVector(xs); + std::reverse(x.begin(), x.end()); + return(x);' R> fun <- cxxfunction(signature(xs="numeric"), body=src, plugin="Rcpp") R> fun( seq(0, 1, 0.1) ) [1] 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 R>
clone()
to make a deep copy (ie forcing
creation of a new object rather than a mere proxy) and use the same R API
function he accessed---but it our case both prefixed with ::Rf_
for R remapping (to protect clashed with other functions with identical names) and a global
namespace identifier (as it is a global C function from R).
Both theR> library(inline) R> src <- 'Rcpp::NumericVector x = Rcpp::clone<Rcpp::NumericVector>(xs); + std::reverse(x.begin(), x.end()); + ::Rf_copyMostAttrib(xs, x); + return(x);' R> fun <- cxxfunction(signature(xs="numeric"), body=src, plugin="Rcpp") R> obj <- structure(seq(0, 1, 0.1), obligatory="hello, world!") R> fun(obj) [1] 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 attr(,"obligatory") [1] "hello, world!" R> obj [1] 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 attr(,"obligatory") [1] "hello, world!" R>
obj
variable and the new copy contain the desired data
attribute, the new copy is reversed, the original is untouched---and all in
four lines of C++ called via one
inline call. I have
now been going on for over one hundred lines yet I never had to mention
memory management, pointers, PROTECT
or other components of the
R API for C. Hopefully, this short writeup provided an idea of why
Romain and I think
Rcpp is the way to
go for creating C/C++ functions for extending and enhancing
R.
I've decided to take over the maintenance of the unofficial emacs-snapshot Debian packages that were maintained by Romain Francoise. They are available on a dedicated page.
ATTENTION ! Votre mot de passe pour de royaume d'authentification : <https://savonet.svn.sourceforge.net:443> SourceForge Subversion area ne peut tre sauvegard qu'en clair !
The text below went out as a post to the
r-packages list a few days ago, but I thought it would make sense to post it
on the blog too. So with a little html markup...
Summary
Version 0.9.0 of the Rcpp package is now on CRAN and its mirrors. This
release marks another step in the development of the package, and a few key
points are highlighted below. More details are in the NEWS and ChangeLog
files included in the package.
Overview
Rcpp is an R package and associated C++ library that facilitates integration
of C++ code in R packages.
The package features a complete set of C++ classes (Rcpp::IntegerVector
,
Rcpp:NumericVector
, Rcpp::Function
, Rcpp::Environment
, ...) that makes it
easier to manipulate R objects of matching types (integer vectors, functions,
environments, etc ...).
Rcpp takes advantage of C++ language features such as the explicit
constructor / destructor lifecycle of objects to manage garbage collection
automatically and transparently. We believe this is a major improvement over
use of PROTECT
/ UNPROTECT
. When an Rcpp object is created, it protects the
underlying SEXP so that the garbage collector does not attempt to reclaim the
memory. This protection is withdrawn when the object goes out of
scope. Moreover, users generally do not need to manage memory directly (via
calls to new / delete or malloc / free) as this is done by the Rcpp classes
or the corresponding STL containers.
A few key points about Rcpp:
which deploys the sugar 'ifelse' function modeled after the corresponding R function. Another simple example isSEXP foo( SEXP xx, SEXP yy) NumericVector x(xx), y(yy) ; return ifelse( x < y, x*x, -(y*y) ) ;
where use the sugar function 'sapply' to sweep a simple C++ function which operates elementwise across the supplied vector. The Rcpp-sugar vignette describes sugar in more detail. Rcpp modules Rcpp modules are inspired by Boost.Python and make exposing C++ functions or classes to R even easier. A first illustration is provided by this simple C++ code snippetdouble square( double x) return x*x ; SEXP foo( SEXP xx ) NumericVector x(xx) ; return sapply( x, square ) ;
which (after compiling and loading) we can access in R asconst char* hello( const std::string& who ) std::string result( "hello " ) ; result += who ; return result.c_str() ; RCPP_MODULE(yada) using namespace Rcpp ; function( "hello", &hello ) ;
In a similar way, C++ classes can be exposed very easily. Rcpp modules are also described in more detail in their own vignette. Reference Classes R release 2.12.0 introduced Reference Classes. These are formal S4 classes with the corresponding dispatch method, but passed by reference and easy to use. Reference Classes can also be exposed to R by using Rcpp modules. Extension packackages The RcppArmadillo package permits use of the advanced C++ library 'Armadillo, a C++ linear algebra library aiming towards a good balance between speed and ease of use, providing integer, floating point and complex matrices and vectors with lapack / blas support via R. Armadillo uses templates for a delayed evaluation approach is employed (during compile time) to combine several operations into one and reduce (or eliminate) the need for temporaries. Armadillo is useful if C++ has been decided as the language of choice, rather than another language like Matlab or Octave, and aims to be as expressive as the former. Via Rcpp and RcppArmadillo, R users now have easy access to this functionality. Examples are provided in the RcppArmadillo package. The RcppGSL package permits easy use of the GNU Scientific Library (GSL), a collection of numerical routines for scientifc computing. It is particularly useful for C and C++ programs as it provides a standard C interface to a wide range of mathematical routines such as special functions, permutations, combinations, fast fourier transforms, eigensystems, random numbers, quadrature, random distributions, quasi-random sequences, Monte Carlo integration, N-tuples, differential equations, simulated annealing, numerical differentiation, interpolation, series acceleration, Chebyshev approximations, root-finding, discrete Hankel transforms physical constants, basis splines and wavelets. There are over 1000 functions in total with an extensive test suite. The RcppGSL package provides an easy-to-use interface between GSL data structures and R using concepts from Rcpp. The RcppGSL package also contains a vignette with more documentation. Legacy 'classic' API Packages still using code interfacing the initial 'classic' Rcpp API are encouraged to migrate to the new API. Should a code transition not be possible, backwards compatibility is provided by the RcppClassic package released alongside Rcpp 0.9.0. By including RcppClassic.h and building against the RcppClassic package and library, vintage code can remain operational using the classic API. The short vignette in the RcppClassic package has more details. Documentation The package contains a total of eight vignettes the first of which provides a short and succinct introduction to the Rcpp package along with several motivating examples. Links Support Questions about Rcpp should be directed to the Rcpp-devel mailing list https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-develyada <- Module( "yada" ) yada$hello( "world" )
Dirk Eddelbuettel, Romain Francois, Doug Bates and John Chambers
December 2010
0.3.8 2010-12-07 o faster cfunction and cxxfunction by loading and resolving the routine at "compile" time
#include <RcppGSL.h> #include <gsl/gsl_matrix.h> #include <gsl/gsl_blas.h> extern "C" SEXP colNorm(SEXP sM) try RcppGSL::matrix<double> M = sM; // create gsl data structures from SEXP int k = M.ncol(); Rcpp::NumericVector n(k); // to store results for (int j = 0; j < k; j++) RcppGSL::vector_view<double> colview = gsl_matrix_column (M, j); n[j] = gsl_blas_dnrm2(colview); M.free() ; return n; // return vector catch( std::exception &ex ) forward_exception_to_r( ex ); catch(...) ::Rf_error( "c++ exception (unknown reason)" ); return R_NilValue; // -WallThis example function is implemented in an example package contained in the RcppGSL package itself -- so that users have a complete stanza to use in their packages. This will then build a user package on Linux, OS X and Windows provided the GSL is installed (and on Windows you have to do all the extra steps of defining an environment variable pointing to and of course install Rtools to build in the first place---Linux and OS X are so much easier for development). Another complete example is in the package itself and provides a faster (compiled) alternative to the standard lm() function in R; this example is the continuation of the same example I had in several versions of my Intro to HPC with R tutorials and in the Rcpp package itself as an early example. We will try to touch base with CRAN package authors using both GSL and Rcpp to see how this can help them. The API in our package may well be incomplete, but we are always happy to try to respond to requests for additional features brought to our attention, preferably via the rcpp-devel list. More information is on the RcppGSL page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page.
Alice: hey bob, got a second?? Bob: yes! Alice: alright cool, I want you to try something real quick Bob : ok Bob : :)At this point, I had zero suspicion about who was really talking to me..
Alice: alright bob, try this test and show me what you get.. i can't get over like a 105, its pathetic http://stupid-iq-test.comYes, looking at the stupid IQ test and knowing some facts about the person asking me to do it, I became suspicious, so I tried a first question:
Bob : what do I get from that ? :) Alice: lemme know what ya get plz, so far everyone beat me, except for Clarence LOL be carfeful some of the questions are hard ;-)Not too bad of an answer! Also, Clarence is one of our common friends and knowing Clarence, he could indeed have challenged Alice. But I was still suspicious so I tried a last question:
Bob: how much did you get ? Alice disconnectedTalking in real life, it appears that it was indeed a bot... I'm quite impressed, though. I wonder now the extend of work they have put in it to make it sound real to me...
0.8.8 2010-11-01 o New syntactic shortcut to extract rows and columns of a Matrix. x(i,_) extracts the i-th row and x(_,i) extracts the i-th column. o Matrix indexing is more efficient. However, faster indexing is disabled if g++ 4.5.0 or later is used. o A few new Rcpp operators such as cumsum, operator=(sugar) o Variety of bug fixes: - column indexing was incorrect in some cases - compilation using clang/llvm (thanks to Karl Millar for the patch) - instantation order of Module corrected - POSIXct, POSIXt now correctly ordered for R 2.12.0As always, even fuller details are on the Rcpp Changelog page and the Rcpp page which also leads to the downloads, the browseable doxygen docs and zip files of doxygen output for the standard formats. A local directory has source and documentation too. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page
o A facility for defining reference-based S4 classes (in the OOP style of Java, C++, etc.) has been added experimentally to package methods; see ?ReferenceClasses. [...] o An experimental new programming model has been added to package methods for reference (OOP-style) classes and methods. See ?ReferenceClasses.This was made possible in large part by code committed by John Chambers (whom we had welcomed recently as a co-author to Rcpp) building on the changes he made to R 2.12.0 itself, as well on the work Romain had done with 'Rcpp Modules'. The R help page for
ReferenceClasses
carries a reference (bad pun) to Rcpp 0.8.7 so these two releases do go
together. This should be a lot of fun over the next little while:
S3, S4, and now ReferenceClasses.
We also made a number of internal changes some of which leads to speed-ups
and internal improvement. The NEWS entry follows below:
0.8.7 2010-10-15 o As of this version, Rcpp depends on R 2.12 or greater as it interfaces the new reference classes (see below) and also reflects the POSIXt class reordering both of which appeared with R version 2.12.0 o new Rcpp::Reference class, that allows internal manipulation of R 2.12.0 reference classes. The class exposes a constructor that takes the name of the target reference class and a field(string) method that implements the proxy pattern to get/set reference fields using callbacks to the R operators "$" and "$<-" in order to preserve the R-level encapsulation o the R side of the preceding item allows methods to be written in R as per ?ReferenceClasses, accessing fields by name and assigning them using "<<-". Classes extracted from modules are R reference classes. They can be subclassed in R, and/or R methods can be defined using the $methods(...) mechanism. o internal performance improvements for Rcpp sugar as well as an added 'noNA()' wrapper to omit tests for NA values -- see the included examples in inst/examples/convolveBenchmarks for the speedups o more internal performance gains with Functions and EnvironmentsAs always, even fuller details are in Rcpp Changelog page and the Rcpp page which also leads to the downloads, the browseable doxygen docs and zip files of doxygen output for the standard formats. A local directory has source and documentation too. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page
Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today.
dh_md5sums
into dh_checksums
with a stronger hash algorithm,
but MD5 still being good enough for simple integrity checking, it seems
rather pointless to upgrade the algorithm without a trust path in the
form of in-package signatures ala RPM...
Anyway, what's perhaps more surprising is the growth of the distribution
in only three years: sid has gone from 20774 to 30314 packages, a 45%
increase. Similarly, the number of regular files has gone from
approximately 2 million to just above 2.9 million.
Indeed, looking at our last five releases, the distribution's growth is
impressive:
select p.package, version, insts from packages p, popcon where (p.architecture = 'i386' or p.architecture = 'all') and p.release = 'squeeze' and p.package = popcon.package and popcon.insts < 500 order by insts;
.)
Next.